package com.zhao.concreteElement;

import com.zhao.concreteVisitor.ComputerPartDisplayVisitor;
import com.zhao.element.ComputerPart;
import com.zhao.visitor.ComputerPartVisitor;

public class Computer implements ComputerPart {

    ComputerPart[] parts;

    public Computer() {
        this.parts = new ComputerPart[]{new Mouse(), new Keyboard(), new Monitor()};
    }

    @Override
    public void accept(ComputerPartVisitor computerPartDisplayVisitor) {
        for (ComputerPart part : parts) {
            part.accept(computerPartDisplayVisitor);
        }
        computerPartDisplayVisitor.visit(this);
    }
}
